package cn.tedu.charging.device.controller;

import cn.tedu.chaging.common.pojo.param.GunStatusUpdateParam;
import cn.tedu.chaging.common.web.JsonResult;
import cn.tedu.chaging.common.pojo.vo.StationInfoVO;
import cn.tedu.charging.device.service.StationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RequestMapping("/device")
@RestController
@Api(tags = "设备场站相关接口")
public class StationController {

    @Autowired
    private StationService stationService;

    @ApiOperation("获取场站信息")
    @GetMapping("/station/info/{gunId}") // url station/info/1
    public JsonResult getStationInfo(@PathVariable("gunId") Integer gunId) {
        log.debug("获取场站信息-{}",gunId);
        StationInfoVO vo = new StationInfoVO();
        vo.setOperatorId(1);
        vo.setStationId(1);
        //JsonResult jsonResult = new JsonResult();
        //jsonResult.setCode(2000);
        //jsonResult.setData(vo);
        return JsonResult.ok(vo);
    }

    @ApiOperation("更新枪的状态")
    @PostMapping("/station/gun/status/update")
    public JsonResult updateGunStatus(GunStatusUpdateParam gunStatusUpdateParam) {
        log.debug("更新枪的状态-{}",gunStatusUpdateParam);
        return JsonResult.ok(true);
    }

    /**
     * 查找用户附近的充电站 位置
     */
    @ApiOperation("附近的充电站")
    @GetMapping("/station/near/")
    public JsonResult getNearByStation(Double longitude,
                                       Double latitude,
                                       Double radius) {
        log.debug("查询附近充电站-经度:{},维度:{},距离:{}",longitude,latitude,radius);
        List<StationInfoVO> stationInfoVOs =  stationService.getNearByStation(longitude,latitude,radius);
        return JsonResult.ok(stationInfoVOs);
    }


    /**
     * 查看充电站详情 R
     */

    /**
     * 查询设备详细 相关的接口
//     * 通过枪id 查
//     * 通过站id 查
     */


}
